/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controladores;

import entidades.DetalleObjetivosPersonales;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author BATAQUERO
 */
@Stateless
public class DetalleObjetivosPersonalesFacade extends AbstractFacade<DetalleObjetivosPersonales> implements DetalleObjetivosPersonalesFacadeLocal {
    @PersistenceContext(unitName = "KonbitacoraPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public DetalleObjetivosPersonalesFacade() {
        super(DetalleObjetivosPersonales.class);
    }

    @Override
    public Integer obtenerMaxid() {
        Integer valorId;
        Query q = em.createNamedQuery("DetalleObjetivosPersonales.findByMaxId");
        valorId = (Integer) q.getSingleResult();
        if (valorId != null) {
            valorId++;
        } else {
            valorId = 1;
        }
        return valorId;
    }
    
}
